home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 042a / bi4.zip / WGETDRIV.PAS < prev   
Pascal/Delphi Source File  |  1993-02-23  |  2KB  |  111 lines

  1. unit WGetDriv;
  2.  
  3. interface
  4. uses
  5.   WinCrt;
  6.  
  7. type
  8.   TFCB = Record
  9.     Drive: Byte;
  10.     Name: array[0..7] of Char;
  11.     Ext: array[0..2] of Char;
  12.     CurBlock: Word;
  13.     RecSize: Word;
  14.     FileSize: LongInt;
  15.     FileDate: Word;
  16.     FileTime: Word;
  17.     Reserved: array[0..7] of Char;
  18.     CurRec: Byte;
  19.     RandRec: LongInt;
  20.   end;
  21.  
  22.   TDBP = Record
  23.     Drive: Byte;
  24.     AUnit: Byte;
  25.     SectorSize: Word;
  26.     Rest: array[0..28] of Byte;
  27.   end;
  28.   PDBP = ^TDBP;
  29.  
  30.  
  31. procedure GetDrives;
  32.  
  33. implementation
  34. var
  35.   Sx: array[0..80] of Char;
  36.   FCBx: TFCB;
  37.   DBP: PDBP;
  38.  
  39. function ISOK(Drive: Byte): Boolean; assembler;
  40. asm
  41.   push ds
  42.   mov dl, Drive
  43.   mov ah, 32h
  44.   int 21h
  45.   cmp al, $FF
  46.   jz  @error
  47.   mov cx, ds
  48.   mov es, cx
  49.   pop ds
  50.   mov word ptr DBP, bx
  51.   mov word ptr DBP + 2, es
  52.   mov al, 1
  53.   jmp @Ok
  54. @error:
  55.   pop ds
  56.   mov al, 0
  57. @Ok:
  58. end;
  59.  
  60.  
  61. function GetInfo: Boolean; assembler;
  62. asm
  63.   push bp
  64.   push ds
  65.   mov si, seg Sx
  66.   mov ds, si
  67.   mov si, offset sx
  68.   mov di, seg FCBx
  69.   mov es, di
  70.   mov di, offset fcbx
  71.   mov al, 1
  72.   mov ah, 29h
  73.   int 21h
  74.   mov bl, al
  75.   mov ax, 1
  76.   cmp bl, $FF
  77.   jnz @Done
  78.   mov ax, 0
  79. @Done:
  80.   pop ds
  81.   pop bp
  82. end;
  83.  
  84. procedure GetDrives;
  85. var
  86.   S1: String;
  87.   i: Integer;
  88.   bad: Boolean;
  89.   S: PChar;
  90.  
  91. begin
  92.   GetMem(S, 80);
  93.   S1 := 'c:*.*';
  94.   FillChar(FCBx, SizeOf(TFCB), #0);
  95.   for i := 0 to 25 do begin
  96.     S1[1] := Chr(i + 65);
  97.     move(S1[1], Sx, Length(S1));
  98.     S[Length(S1)] := #0;
  99.     Bad := GetInfo;
  100.     if bad then begin
  101.       Write(S1);
  102.       if (i = 0) or (i = 1) then
  103.         WriteLn(' -> Normal')
  104.       else
  105.         if IsOk(i+1) then WriteLn(' -> Normal')
  106.         else WriteLn(' -> Special');
  107.     end;
  108.   end;
  109.   FreeMem(S, 80);
  110. end;
  111. end.